<?php

namespace app\common\model\goods;

use app\common\model\BaseModel;

class Goods extends BaseModel
{
    protected $name = 'goods';
    protected $pk = 'id';

    protected $autoWriteTimestamp = 'int';
    protected $createTime = 'add_time';
    protected $updateTime = false;

    protected $type = [
        'add_time' => 'timestamp',
    ];
    
    /**
     * 字段验证规则
     * @var array
     */
    protected $schema = [
        'id'            => 'int',
        'name'          => 'string',
        'description'   => 'string',
        'price'         => 'float',
        'stock'         => 'int',
        'image_url'     => 'string',
        'category_id'   => 'int',
        'status'        => 'int',
        'add_time'      => 'timestamp',
    ];
}